import { Body, Controller, Post } from '@nestjs/common';
import RegisterDto from './dto/register.dto';
import { PrismaClient } from '@prisma/client';

@Controller('auth')
export class AuthController {
    constructor(){
        this.prisma = new PrismaClient()
    }
    prisma:PrismaClient
    @Post('register')
    async register(@Body() dto:RegisterDto){
        const user = await this.prisma.user.create({
            data:{
                name:dto.name,
                password:dto.password
            }
        })
        return user
    }
}
